#include "../../muduo/buffer.hpp"


int main()
{
    // Muduo::Buffer buf;
    // std::string str = "hello world";
    // buf.WriteStringAndPush(str);
    // Muduo::Buffer buf1;
    // buf1.WriteBufferAndPush(buf);
    // std::string tmp;
    // tmp = buf.ReadAsStringAndPop(buf.ReadAbleSize());
    // std::cout<<tmp<<std::endl;
    // tmp = buf1.ReadAsStringAndPop(buf1.ReadAbleSize());
    // std::cout<<tmp<<std::endl;
    Muduo::Buffer buf;
    for(int i = 0;i<5000;i++)
    {
        std::string str = "hello"+std::to_string(i)+'\n';
        buf.WriteStringAndPush(str);
    }

    while(buf.ReadAbleSize()>0)
    {
        std::string line = buf.GetLineAndPop();
        // std::cout<<line<<std::endl;
        DLOG("%s",line.c_str());
    }
    std::cout<<buf.ReadAbleSize()<<std::endl;

    // std::string tmp;
    // std::cout<<buf.ReadAbleSize()<<":"<<tmp<<std::endl;
    // tmp = buf.ReadAsStringAndPop(buf.ReadAbleSize());
    // std::cout<<buf.ReadAbleSize()<<":"<<tmp<<std::endl;
    return 0;
}